import { app, ipcMain } from "electron"
import { handleRendererSend } from "./core/ipc/template-dispatcher"
import loginWindow from "./window/login"
import mainWindow from "./window/main-window"
import { lowdbDefault } from "./core/data/local/kv-datasource"

app.whenReady().then(() => {
  ipcMain.on("rendererSend", handleRendererSend)
  const loginStatus: boolean = lowdbDefault.getBoolean("loginStatus", false)
  if (loginStatus) {
    mainWindow.createWindow()
  } else {
    loginWindow.openWindow()

  }
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit()
})





